﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<SuperStore.Models.Game>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Game Catalog</h2>
    Select page:
    <% Html.RenderPartial("Pager"); %>
    <table>
        <tr>
            <th>
            </th>
            <th>
                Title
            </th>
            <th>
                Genre
            </th>
            <th>
                Release Date
            </th>
            <th>
                Rating
            </th>
            <th>
                Cost
            </th>
            <th>
                Image
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <a href="<%: Url.Action("Add", "Cart", new  { gameID=item.PK })%>">
                    <img src="/Content/images/cart_add.png" alt="Add to Cart" /></a>
            </td>
            <td>
                <%: item.Title %>
            </td>
            <td>
                <%: item.Genre %>
            </td>
            <td>
                <%: String.Format("{0:dd MMM yyyy}", item.ReleaseDate) %>
            </td>
            <td>
                <img src="/content/images/ratings/ESRB_<%: item.Rating %>.gif" alt="<%: item.Rating %>" />
            </td>
            <td>
                <% if (item.Arcade)
                   {%>
                <%: item.MSPointsCost %>
                Points
                <%}
                   else
                   {%>
                <%: String.Format("{0:F}", item.RetailCost) %>
                <%}
                %>
            </td>
            <td>
                <img src="/content/images/<%: item.Image %>" alt="Box Art" />
            </td>
        </tr>
        <% } %>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
